﻿using System;

namespace ConnectionObjects
{
    [Serializable]
    public class InConnectionObject
    {
        private string m_MethodToInvoke;
        private object[] m_InParameters;
        private int m_NumberOfInParams;
        private bool m_HasReturnValue;

        public InConnectionObject(string method, object[] parameters, bool hasReturnValue)
        {
            m_MethodToInvoke = method;
            handleParams(parameters);
            m_HasReturnValue = hasReturnValue;
            m_NumberOfInParams = parameters.Length;
        }

        public bool HasReturnValue
        {
            get { return m_HasReturnValue; }
        }

        public int NumberOfInParams
        {
            get { return m_NumberOfInParams; }
        }

        public string MethodToInvoke
        {
            get { return m_MethodToInvoke; }
        }

        public object[] InParameters
        {
            get { return m_InParameters; }
        }

        private void handleParams(object[] parameters)
        {
            if (parameters == null)
            {
                m_InParameters = null;
            }
            else
            {
                m_InParameters = new object[parameters.Length];
                for (int i = 0; i < parameters.Length; i++)
                {
                    m_InParameters[i] = parameters[i];
                }
            }

        }
    }
}
